﻿using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using wt.wine.Application.ManageDevicetable;
using wt.wine.Domain.Entities;
using wt.wine.Application.Common.Models;
using System;

namespace wt.wine.Application.Common.Interfaces
{
    /// <summary>
    /// 
    /// </summary>
    public interface IDevicetableRepository
    {
        /// <summary>
        /// 出酒获取设备名
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<List<GetDevicetableNameDTO>> GetDevicetableNameByUserId(int userid, CancellationToken cancellationtoken);

        /// <summary>
        /// 出酒获取设备名
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<List<GetDevicetableNameDTO>> GetDevicetableNameByAdmin(int userid, CancellationToken cancellationtoken);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<devicetable> GetDevicetableByid(int id, CancellationToken cancellationtoken);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<devicetable> GetDevicetableByid(string device, CancellationToken cancellationtoken);

        /// <summary>
        /// 新增设备
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<int> AddDeviceTable(devicetable model, CancellationToken cancellationtoken);

        /// <summary>
        /// 修改出酒
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<int> EditDeviceTable(devicetable model, CancellationToken cancellationtoken);

        /// <summary>
        /// 修改出酒
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<int> EditManageDeviceTable(devicetable model, CancellationToken cancellationtoken);

        /// <summary>
        /// 设备列表
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<PaginatedList<GetDevicetableListByUserIdDTO>> GetDeviceListByUserId(int userid,string device, int pageIndex, int pageSize, CancellationToken cancellationtoken);

        /// <summary>
        /// 判断当前设备号是否存在
        /// </summary>
        /// <param name="id"></param>
        /// <param name="device"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<int> GetDeviceCount(int id, string device, CancellationToken cancellationtoken);

        /// <summary>
        /// 获取经销商设备量
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<int> GetCountByUserId(int userid, CancellationToken cancellationtoken);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<List<GetDeviceNameByAddWineDTO>> GetDeviceListByAddWine(int userid, CancellationToken cancellationtoken);

        /// <summary>
        /// 修改当前设备当前存储酒量
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task EditDevicecapacitythreshold(devicetable model, CancellationToken cancellationtoken);

        /// <summary>
        /// 【经销商】缺酒补货提醒
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<PaginatedList<GetDeviceLessWineDTO>> GetDeviceLessWineList(int userid, int pageIndex, int pageSize, CancellationToken cancellationtoken);

        /// <summary>
        /// 通过id获取设备信息
        /// </summary>
        /// <param name="id"></param>
        /// <param name="userid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<GetDeviceByIdDTO> GetDeviceById(int id, int userid, CancellationToken cancellationtoken);

        /// <summary>
        /// 通过多个id获取绑定数据
        /// </summary>
        /// <param name="list_ids"></param>
        /// <param name="userid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<List<devicetable>> GetDevicetableListByIds(List<int> list_ids, int userid, CancellationToken cancellationtoken);

        /// <summary>
        /// 添加员工获取设备列表
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<List<GetDeviceByAddUserDTO>> GetDeviceByAddUser(int userid, CancellationToken cancellationtoken);

        /// <summary>
        /// 回调修改设备状态
        /// </summary>
        /// <param name="model"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task EditDeviceState(devicetable model,int oow, CancellationToken cancellationtoken);

        /// <summary>
        /// 获取设备在线状态
        /// </summary>
        /// <param name="listdevice"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<List<devicetable>> GetDeviceList(List<string> listdevice, DateTime dt_now, CancellationToken cancellationtoken);

        /// <summary>
        /// 【平台】获取所有设备
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<PaginatedList<GetManageDeviceListDTO>> GetManageDeviceList(int userid, int pageIndex, int pageSize, CancellationToken cancellationtoken);

        /// <summary>
        /// 【平台】获取设备详情
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="id"></param>
        /// <param name="cancellationtoken"></param>
        /// <returns></returns>
        Task<GetDeviceModelByIdDTO> GetDeviceModelById(int userid, int id, CancellationToken cancellationtoken);
        Task<int> GetNeedAddWineCount(int userid,CancellationToken cancellationToken);
        GetDeviceNameByAddWineDTO GetDeviceListByAddWine(int userid, int did, CancellationToken cancellationtoken);
    }
}
